clear all

% baseline
alphaT = 4;
rhoT = '3';
J = 32;
rho = 3*ones(J,1);
sigma = 1.5*ones(J,1);
sigmaT = '1.5';
lambdaT = '1.000001';
lambda = 1.000001;
etaT = '1.000001';
eta = 1.000001;
varphi = 3;
alphaT='4';
master_baseline_CES_approx;
master_counterfactuals_CES_approx;
master_counterfactuals_CES_Homogeneous_approx;

% Baseline: Country loop
master_counterfactuals_CES_approx_countryloop;
master_counterfactuals_CES_Homogeneous_approx_countryloop

% Idiosyncratic shocks
master_counterfactuals_CES_idiosyncraticprodshock_byfirm;
master_count_CES_idioprodshock_byfirm_homogeneous;

% Robustness
% High rho
alphaT = 4;
rhoT = '5';
J = 32;
rho = 5*ones(J,1);
sigma = 1.5*ones(J,1);
sigmaT = '1.5';
lambdaT = '1.000001';
lambda = 1.000001;
etaT = '1.000001';
eta = 1.000001;
varphi = 3;
master_baseline_CES_approx;
master_counterfactuals_CES_approx;
master_counterfactuals_CES_Homogeneous_approx;

% Low rho
alphaT = 4;
rhoT = '1.5';
J = 32;
rho = 1.5*ones(J,1);
sigma = 1.5*ones(J,1);
sigmaT = '1.5';
lambdaT = '1.000001';
lambda = 1.000001;
etaT = '1.000001';
eta = 1.000001;
varphi = 3;
master_baseline_CES_approx;
master_counterfactuals_CES_approx;
master_counterfactuals_CES_Homogeneous_approx;

% High Frisch
alphaT = 4;
rhoT = '3';
J = 32;
rho = 3*ones(J,1);
sigma = 1.5*ones(J,1);
sigmaT = '1.5';
lambdaT = '1.000001';
lambda = 1.000001;
etaT = '1.000001';
eta = 1.000001;
varphi = 1.5;
master_baseline_CES_approx;
master_counterfactuals_CES_approx;
master_counterfactuals_CES_Homogeneous_approx;

% Low Frisch
alphaT = 4;
rhoT = '3';
J = 32;
rho = 3*ones(J,1);
sigma = 1.5*ones(J,1);
sigmaT = '1.5';
lambdaT = '1.000001';
lambda = 1.000001;
etaT = '1.000001';
eta = 1.000001;
varphi = 11;
master_baseline_CES_approx;
master_counterfactuals_CES_approx;
master_counterfactuals_CES_Homogeneous_approx;

% High eta
alphaT = 4;
rhoT = '3';
J = 32;
rho = 3*ones(J,1);
sigma = 1.5*ones(J,1);
sigmaT = '1.5';
lambdaT = '1.000001';
lambda = 1.000001;
etaT = '1.5';
eta = 1.5;
varphi = 3;
master_baseline_CES_approx;
master_counterfactuals_CES_approx;
master_counterfactuals_CES_Homogeneous_approx;

% Low eta
alphaT = 4;
rhoT = '3';
J = 32;
rho = 3*ones(J,1);
sigma = 1.5*ones(J,1);
sigmaT = '1.5';
lambdaT = '1.000001';
lambda = 1.000001;
etaT = '0.5';
eta = 0.5;
varphi = 3;
master_baseline_CES_approx;
master_counterfactuals_CES_approx;
master_counterfactuals_CES_Homogeneous_approx;

% High phi
alphaT = 4;
rhoT = '3';
J = 32;
rho = 3*ones(J,1);
sigma = 1.5*ones(J,1);
sigmaT = '1.5';
lambdaT = '1.5';
lambda = 1.5;
etaT = '1.000001';
eta = 1.000001;
varphi = 3;
master_baseline_CES_approx;
master_counterfactuals_CES_approx;
master_counterfactuals_CES_Homogeneous_approx;

% Low phi
alphaT = 4;
rhoT = '3';
J = 32;
rho = 3*ones(J,1);
sigma = 1.5*ones(J,1);
sigmaT = '1.5';
lambdaT = '0.5';
lambda = 0.5;
etaT = '1.000001';
eta = 1.000001;
varphi = 3;
master_baseline_CES_approx;
master_counterfactuals_CES_approx;
master_counterfactuals_CES_Homogeneous_approx;

% High sigma
alphaT = 4;
rhoT = '3';
J = 32;
rho = 3*ones(J,1);
sigma = 3*ones(J,1);
sigmaT = '3';
lambdaT = '1.000001';
lambda = 1.000001;
etaT = '1.000001';
eta = 1.000001;
varphi = 3;
master_baseline_CES_approx;
master_counterfactuals_CES_approx;
master_counterfactuals_CES_Homogeneous_approx;

% low sigma
alphaT = 4;
rhoT = '3';
J = 32;
rho = 3*ones(J,1);
sigma = 1.1*ones(J,1);
sigmaT = '1.1';
lambdaT = '1.000001';
lambda = 1.000001;
etaT = '1.000001';
eta = 1.000001;
varphi = 3;
master_baseline_CES_approx;
master_counterfactuals_CES_approx;
master_counterfactuals_CES_Homogeneous_approx;

% Flexible markups
alphaT = 4;
rhoT = '3';
J = 32;
rho = 3*ones(J,1);
sigma = 1.5*ones(J,1);
sigmaT = '1.5';
lambdaT = '1.000001';
lambda = 1.000001;
etaT = '1.000001';
eta = 1.000001;
varphi = 3;
master_baseline_CES_approx_Olig;
master_counterfactuals_CES_approx_Olig;

% Changing profit in final demand
clear;
alphaT = 4;
rhoT = '3';
J = 32;
rho = 3*ones(J,1);
sigma = 1.5*ones(J,1);
sigmaT = '1.5';
lambdaT = '1.000001';
lambda = 1.000001;
etaT = '1.000001';
eta = 1.000001;
varphi = 3;
master_baseline_CES_approx_Profit;
master_counterfactuals_CES_approx_Profit;
master_counterfactuals_CES_Homogeneous_approx_Profit;
